"""
@Project:p9_exe
@File:serializer.py
@Author:郑凯乐
@Date:14:55
"""
from rest_framework import serializers
from .models import *

# 菜品种类的序列化器
class CateSer(serializers.ModelSerializer):
    class Meta:
        model = GoodTypeModel
        fields = "__all__"

class ShopsSer(serializers.ModelSerializer):
    # 仅作序列化输入，不让暴露密码
    password = serializers.CharField(write_only=True,trim_whitespace=True,max_length=50,min_length=2,)
    class Meta:
        model = ShopsModel
        fields = ["id", "name", "password","avatar_url", "mobile", ]
        read_only_fields = ["id", "date_joined"]


# 菜品的序列化器
class DishesClassifySer(serializers.ModelSerializer):
    class Meta:
        model = GoodModel
        fields = "__all__"

# 展示所有商家的序列化器
class ShopssSer(serializers.ModelSerializer):
    class Meta:
        model = ShopsModel
        fields = "__all__"
